from gevent import monkey; monkey.patch_all()#必须放在最前面
import gevent
from time import sleep

def a():
    for i in range(3):
        print('-------a-----{}'.format(i))
        sleep(1)


def b():
    for i in range(3):
        print('-------b-----{}'.format(i))
        sleep(1)


def c():
    for i in range(3):
        print('-------c-----{}'.format(i))
        sleep(1)


if __name__ == '__main__':
    ga = gevent.spawn(a)
    gb = gevent.spawn(b)
    gc = gevent.spawn(c)

    ga.join()
    gb.join()
    gc.join()
'''
-------a-----0
-------b-----0
-------c-----0
-------a-----1
-------b-----1
-------c-----1
'''